_m_k_d_i_r creates a new directory with the name _p_a_t_h. The mode of the new
directory is initialized from _m_o_d_e (see _c_h_m_o_d(2) for values of _m_o_d_e].
The protection part of _m_o_d_e is modified by the process's mode mask (see
_u_m_a_s_k(2)). The _SSSS______IIII_SSSS_GGGG_IIII_DDDD, _SSSS______IIII_SSSS_UUUU_IIII_DDDD, and _SSSS______IIII_SSSS_VVVV_TTTT_XXXX bits are silently deleted
from _m_o_d_e.
The directory's owner ID is set to the process's effective user ID. The
directory's group ID is set to the process's effective group ID or the
group ID of the directory in which the directory is being created. This
is determined as follows:
If the underlying filesystem was mounted with the BSD file creation
semantics flag (see _f_s_t_a_b(4)) or the SSSS____IIIISSSSGGGGIIIIDDDD bit is set (see _c_h_m_o_d(2)) on
the parent directory, then the group ID of the new is set to the group
ID of the parent directory, otherwise it is set to the effective group ID
of the calling process.
The newly created directory is empty with the possible exception of
entries for itself (.) and its parent directory (..).
Upon successful completion, _m_k_d_i_r marks for update the sssstttt____aaaattttiiiimmmmeeee, sssstttt____ccccttttiiiimmmmeeee
and sssstttt____mmmmttttiiiimmmmeeee fields of the directory. Also, the sssstttt____ccccttttiiiimmmmeeee and sssstttt____mmmmttttiiiimmmmeeee
fields of the directory that contains the new entry are marked for
update.
_m_k_d_i_r will fail and no directory will be created if one or more of the
following are true:
[ENOTDIR] A component of the path prefix is not a directory.
[ENOENT] A component of the path prefix does not exist.
[ENAMETOOLONG] The length of the _p_a_t_h argument exceeds {_P_A_T_H__M_A_X}, or a
pathname component is longer than {_N_A_M_E__M_A_X}.
[EACCES] Either a component of the path prefix denies search
permission or write permission is denied on the parent